<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>{BEESCRM:$title}</title>
    <meta name="description" content="">
    <meta name="HandheldFriendly" content="True">
    <meta name="MobileOptimized" content="320">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui, user-scalable=no">
    <meta http-equiv="cleartype" content="on">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/assets/base/busbooking/css/style.css">
    <link rel="stylesheet" href="/assets/base/busbooking/css/mobiscroll.custom-3.0.0-beta2.min.css">
    <link rel="stylesheet" href="/assets/base/busbooking/css/layer.css">
</head>
<body>
<div class="wraper">
    <div class="header flex-between">
        <a href="javascript:history.go(-1)" class="iconfont icon-llmainpageback "></a>

        <div class="title text-center font-16">购票名单</div>
        <a href="#" class="iconfont icon-saomiao-copy" id="qrcode"></a>
    </div>
    <div class="content js-address" >
        <div class="list ">

            <div class="flex-between address-campus">
                <div>{BEESCRM:$firstinfo[0]['start_address']}</div>
                <div class="arrows">
                    <p class="text-center" id="times">20{BEESCRM:$firstinfo[0]['check_time']|date='y-m-d',###}&nbsp; {BEESCRM:$firstinfo[0]['departure_time']}</p>
                    <img src="/assets/base/busbooking/images/jiantou.png" alt="">
                </div>
                <div>{BEESCRM:$firstinfo[0]['end_address']}</div>
            </div>

            <div class="iconfont icon-chevron-copy-copy-copy-copy-copy-copy icon-skip"></div>
        </div>
    </div>
    <div class="content" id="1stpage">
        <volist name="firstinfo" id="vo">
            <div class="list flex-between js_list">
                <div>
                    <if condition="$vo.status eq 2"> 已使用
                        <elseif condition="$vo.status eq 3"/>
                        已过期
                        <elseif condition="$vo.status eq 1"/>
                        待检票
                    </if>
                </div>
                <div class="">{BEESCRM:$vo.real_name}</div>
                <div>
                    <span class="number">{BEESCRM:$vo.mobile}</span>
                    <a href="" class="iconfont icon-dianhua"></a>
                </div>
            </div>
        </volist>
    </div>

    <div class="bottom-hint text-center flex-3" ><span class="margin-4 gray2"  id="more"></span></div>

    <div class="pop-box hide">
        <div class="pop-hint">
            <div class="header flex-between">
                <a href="#" class="iconfont icon-llmainpageback js_back"></a>

                <div class="title text-center font-16">请选择购票班次</div>
                <a href="#" class="gray ensure" id="btn">确定</a>
            </div>
            <div class="pop-boxs margin-t12">
                <volist name="classinfo" id="vo">
                    <div class="pop-list flex-between">
                        <span>20{BEESCRM:$vo.check_time|date='y-m-d',###}&nbsp;{BEESCRM:$vo.departure_time}</span>
                        <span>{BEESCRM:$vo.start_address}-{BEESCRM:$vo.end_address}({BEESCRM:$vo.bus_count}人)</span>
                        <input type="hidden" id="{BEESCRM:$vo.order_id}" data-class_id="{BEESCRM:$vo.class_id}"
                               data-check_time="{BEESCRM:$vo.check_time}" value="{BEESCRM:$vo.order_id}">
                    </div>
                </volist>
            </div>
        </div>
    </div>
</div>
</body>
<script src="/assets/base/busbooking/js/jquery-2.1.0.min.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="/assets/base/busbooking/js/layer.js"></script>
<script src="/assets/base/busbooking/js/public.js"></script>
<include file="share_header"/><!--wx.config配置-->
<script>
    $('.icon-dianhua').click(function () {
        var number = $(this).siblings('.number').text();
        $(this).attr("href", 'tel:' + number);
    })
//    $(function () {
//        $('.js_list').each(function () {
//            var name = $(this).children('.name').html();
//            var name2 = name.substr(0, 1);
//            var lenght = name.length - 1;
//            var num = '';
//            for (var i = 1; i <= lenght; i++) {
//                num += '*';
//            }
//            $(this).children('.name').html(name2 + num);
//        });
//    })
    $('.pop-box').on('click', '.pop-list', function () {
        $(this).addClass('pop-active').siblings().removeClass('pop-active');
    })
    $('.js-address').click(function () {
        $('.pop-box').removeClass('hide');
    })
    $('.js_back,.ensure').click(function () {
        $('.pop-box').addClass('hide');
    })
    $(function () {
        var height = $(window).height() - $('.header').outerHeight() - 12;
        $('.pop-boxs').css('height', height);
    })
    $('#btn').click(function () {
        var class_id = 0;
        var check_time = 0;
        $('.pop-list').each(function () {
            if ($(this).hasClass('pop-active')) {
                class_id = $(this).children('input').data('class_id');
                check_time = $(this).children('input').data('check_time');
            }
        })
        window.location.href = '/Base/BusBookingCheck/ticketList/apply_id/{BEESCRM:$applyId}/class_id/' + class_id + '/check_time/' + check_time;
    })

    //调起二维码扫一扫
    $(document).ready(function () {
        $(document).on('click', '.icon-saomiao-copy', function () {
            wx.scanQRCode({
                needResult: 0, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
                scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码，默认二者都有
                success: function (res) {
                    var result = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
                }
            });
        });
    })
    var page=0;
    //异步加载班车订单信息
    $(window).scroll(function (event) {
        if ($(document).scrollTop() + $(window).height() > $(document).height() - 20) {
            ajax_get_order();
        }
    });

    function ajax_get_order() {
        var class_id={BEESCRM:$firstinfo[0]['class_id']};
        var check_time={BEESCRM:$firstinfo[0]['check_time']};
        page +=15;
        $.ajax({
            data: {page: page, is_ajax: 1,class_id:class_id,check_time:check_time},
            method: 'post',
            dataType: 'html',
            url: '/Base/BusBookingCheck/ajax_order/apply_id/{BEESCRM:$applyId}',
            success: function (data) {
                if (data == '') {
                    $('#more').text('没有更多了');
                } else {
                    $("#1stpage").append(data);
                }
            }
        });
    }
</script>
</html>